-
-
Notifications
You must be signed in to change notification settings - Fork 23k
Fix: prevent ssrf and Input type confusion issues multiple components #5336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@poratoes
poratoes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Harden outbound requests and strengthen input validation across components and server.
- Add HTTP allow-list support (HTTP_ALLOW_LIST) and checkAllowList; enforce for secureFetch initial URL and redirects; only http/https allowed (reduces SSRF risk).
- Make _cleanEmptyS3Folders defensive against unexpected prefix types (handle arrays, ignore non-string/empty prefixes).
- Normalize and sanitize feedbackType query param (accept CSV, JSON array string, or array) in chat-messages controller.
- Validate Azure tenantID format in AzureSSO.testSetup to fail fast on invalid config.
- Validate chatflowId(s) in createEvaluation (parse array or single id, disallow suspicious characters, ensure IDs exist).
Notes:
- Behavior change: secureFetch now requires HTTP_ALLOW_LIST to be configured in environments where allow-list enforcement is desired — set this env var in tests/CI if needed.
- Adds security and robustness fixes; recommend adding unit tests for allow-list/redirects, tenantID validation, feedbackType parsing, S3 prefix handling, and chatflowId validation.
@coderabbitai review
✅ Actions performed
Review triggered.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Warning
Rate limit exceeded
@HenryHengZJ has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 58 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.
We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.
📒 Files selected for processing (5)
packages/components/src/httpSecurity.ts(3 hunks)packages/components/src/storageUtils.ts(1 hunks)packages/server/src/controllers/chat-messages/index.ts(2 hunks)packages/server/src/enterprise/sso/AzureSSO.ts(2 hunks)packages/server/src/services/evaluations/index.ts(1 hunks)
✨ Finishing touches
- 📝 Generate docstrings
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
Comment @coderabbitai help to get the list of available commands and usage tips.
Description Of Fixes
This request fixes an addresses multiple security vulnerabilities related to Server-Side Request Forgery (SSRF) and unvalidated user input handling across several files within the FlowiseAI codebase. These issues could allow attackers to manipulate outgoing requests, access unintended internal resources, or exploit type confusion to bypass sanitization logic. Each fix introduces proper input validation, allow-list enforcement, and type-safety improvements to ensure robust protection against such threats.
1. Secure Tenant ID Validation in Azure SSO
packages/server/src/enterprise/sso/AzureSSO.tsThetestSetupstatic method previously allowed unvalidated user input (tenantID) to control the hostname in an outgoing HTTP request to Microsoft Azure.This could enable SSRF attacks by redirecting requests to unintended endpoints or internal services.
Fix implemented:
tenantIDbefore constructing the authentication URL..onmicrosoft.com.2. Outbound Request Allow-List for Secure Fetch
packages/components/src/httpSecurity.tsPreviously, user-supplied URLs were used directly in outbound HTTP requests, protected only by a deny-list. This approach left room for bypass attacks or indirect SSRF through redirects.Fix implemented:
secureFetchfunction for both the initial URL and all redirects.HTTP_ALLOW_LIST, defining a comma-separated list of allowed domains or wildcard patterns (e.g.,*.example.com).httpandhttpsonly.3. Validation of Chatflow IDs in Evaluation Service
packages/server/src/services/evaluations/index.tsThe service previously used unvalidatedchatflowIdvalues to construct request URLs, creating a potential SSRF vector if arbitrary IDs were supplied.Fix implemented:
chatflowIdbefore executingEvaluationRunner.runEvaluations.4. Type-Safe Validation for Feedback Parameters
packages/server/src/controllers/chat-messages/index.tsCertain query parameters (feedbackType) were assumed to be strings but could be arrays due to crafted malicious requests. This type confusion could bypass sanitization logic.Fix implemented:
feedbackTypeparameters.ChatMessageRatingTypeenum values are accepted.5. Runtime Type Enforcement for Storage Prefix Parameters
packages/components/src/storageUtils.tsUnvalidatedprefixparameters could cause unsafe string operations or logic errors if arrays or non-string types were passed in.Fix implemented:
prefixis always a valid string before operations likesubstringor concatenation._cleanEmptyS3Foldersfor minimal code impact and maximum safety.These changes collectively harden the application against:
All fixes follow the principle of defense in depth, ensuring that user inputs are validated, sanitized, and restricted at the earliest possible stage.
secureFetchcorrectly blocks disallowed domains.Additional Notes
HTTP_ALLOW_LISTcan be provided via environment variables or config files.